<!doctype html>
<html lang="en">

	<head>
		<!-- Required meta tags -->
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

		<title>入金</title>

	</head>

	<body>
		<!--HEADER-->
		{include file="Public/header"/}
		<!--HEADER-->
		<div class="clearfix clearfix20"></div>
		<div class="container futuresDeposit">
			<div class="row">

				<!--<h2>个人中心</h2>-->
				{include file="Public/readme"/}
				<div class="col-md-9">

					<div class="panel panel-default">
						<div class="panel-heading">
							<h3 class="panel-title">期货入金</h3>
						</div>
					</div>
					<a class="btn btn-primary active cursorD" href="/home/Futures/golden" role="tab" data-toggle="tab">期货入金</a>
					<a class="btn btn-default cursorD" href="/home/Futures/withdraw">期货出金</a>
					<div class="clearfix clearfix20"></div>
					<div class="tab-content">
						<!--<div role="tabpanel" class="tab-pane active" id="home">-->
							<!--<ul>-->
								<!--<li>国内期货出入金金额大于9999999元需要管理员审核</li>-->
								<!--<li>期货入金金额直接从账户余额里面扣除，当前可用余额<b class="text-danger">{$ste.balance}</b>元。</li>-->
								<!--<li>国内期货出金金额直接从国内期货账户里面扣除，当前国内期货账户自有资金<b class="text-info">{$data.bad}</b>元,保证金<b class="text-info">{$data.Margin}</b>元,可用金额<b class="text-info">{$data.Available}</b>元。</li>-->
							<!--</ul>-->
						<!--</div>-->
						<form class="form-inline" action="/home/Futures/golden" method="post">
							<!--<div class="form-group">
								<label class="sr-only" for="payRj"></label>
								<div class="input-group">
									<div class="input-group-addon">¥</div>
									<input type="hidden" name="codes" value="{:session('codes')}">
									<input type="number" class="form-control" id="payRj" name="payRj" min="0" step="0.01" placeholder="期货入金" required="required">
									<div class="input-group-addon">.00</div>
								</div>
							</div>
							<button type="submit" class="btn btn-danger">期货入金</button>-->


							<!--<table class="table table-bordered table-hover">-->
								<!--<tr>-->
									<!--<th>当前自有资金</th>-->
									<!--<th>当前借贷资金</th>-->
									<!--<th>余额</th>-->
								<!--</tr>-->
								<!--<tr>-->
									<!--<td class="nowLH">{$data.bad}</td>-->
									<!--<td class="nowYX">{$data.Available-$data.bad}</td>-->
									<!--<td class="nowYE">{$ste.balance}</td>-->
								<!--</tr>-->
							<!--</table>-->


							<table class="table table-bordered table-hover" style="width:270px;">
								<tr>
									<th class="text-right">当前账户余额:</th>
									<td class="nowYE">{$ste.balance}</td>
								</tr>
								<tr>
									<th class="text-right">当前期货账户借贷资金:</th>
									<td class="nowYX">{$data.Available-$data.bad}</td>
								</tr>
								<tr>
									<th class="text-right">当前期货账户自有资金:</th>
									<td class="nowLH">{$data.bad}</td>
								</tr>
								
								<tr>
									<th class="text-right">当前期货账户保证金占用:</th>
									<td >{$data.Margin}</td>
								</tr>
								<tr>
									<th class="text-right">当前期货账户可用金额（自有+借贷）:</th>
									<td >{$data.Available}</td>
								</tr>
							</table>

							<table class="table">
								<tr>
									<td>入金金额</td>
									<td>
										<div class="form-group">
											<label class="sr-only" for="payRj"></label>
											<div class="input-group">
												<input type="hidden" name="codes" value="{:session('codes')}">
												<input type="number" class="form-control" id="payRj" value="{$ste.balance}" style="width:150px;" name="payRj" min="0" max="{$ste.balance}" step="0.01" placeholder="入金金额" required="required">

												<span class="mt-2 ml-1">(可入金最大金额{$ste.balance})</span>
											</div>
										</div>
									</td>
								</tr>


								<tr>
									<td>是否借贷</td>
									<td>
										<div class="skin-minimal">
											<div class="check-box">
												<label class="radio-inline">
													<input type="radio" name="sf" id="sf10" value="10" checked='checked'> 10倍　
												</label>
												<label class="radio-inline">
													<input type="radio" name="sf" id="sf08" value="8"> 8倍　
												</label>
												<label class="radio-inline">
													<input type="radio" name="sf" id="sf05" value="5"> 5倍　
												</label>
												<label class="radio-inline">
													<input type="radio" name="sf" id="sf03" value="3"> 3倍　
												</label>
												<label class="radio-inline">
													<input type="radio" name="sf" id="sf02" value="2"> 2倍　
												</label>
												<label class="radio-inline">
													<input type="radio" name="sf" id="sf01" value="1"> 不借贷　
												</label>
											</div>
										</div>
									</td>
								</tr>

								<tr>
									<td colspan="2">
										<label class="form-check-label" for="noFundAllocation">不进行借贷<span style="color: red;">（如果勾选本次入金不会进行借贷）</span></label>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										借贷金额(最大不能超过500万)
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<div class="form-group">
											<label class="sr-only" for="payPz"></label>
											<div class="input-group">
												<input type="text" class="form-control" id="payPz" value="{$ste.balance*10+$data.bad*10}" style="width: 150px;" name="payPz" min="0" max="{$ste.balance*10+$data.bad*10}" step="0.01" placeholder="借贷金额" required="required">

												<span class="mt-2 ml-1" id="Pz">(可借贷最大金额{$ste.balance*10+$data.bad*10})</span>
											</div>
										</div>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<button type="submit" class="btn btn-danger">期货入金</button>
									</td>
								</tr>
								<tr>
									<td colspan="2"></td>
								</tr>
							</table>
						</form>
						</div>
					</div>

				</div>
			</div>

			<br /><br /><br /><br /><br />
			<!--footer-->
			{include file="Public/footer"/}

			<script>
				
				
				
				
				
				$("#collapseOne").find(".list-group").find("li").eq(2).addClass("active");
				$("#payRj").change(function() {
					//				nowLH	当前劣后
					//				nowYX	当前优先
					//				nowYE	余额
					var nowLH = $(".nowLH").html();
					var nowYX = $(".nowYX").html();
					var nowYE = $(".nowYE").html();
					var payRj = $("#payRj").val();
					var maxPz = parseFloat(payRj) * 10 + parseFloat(nowLH) * 10;
					var pzAmount = parseFloat(payRj) + parseFloat(nowLH);
					
//是否借贷
				$("input[name='sf']").on("click",function(){					
					if($(this).val() == 10){						
						$("#payPz").val((pzAmount*10).toFixed(2))						
					}
					if($(this).val() == 8){
						$("#payPz").val((pzAmount*8).toFixed(2))
					}
					if($(this).val() == 5){
						$("#payPz").val((pzAmount*5).toFixed(2))
					}
					if($(this).val() == 3){
						$("#payPz").val((pzAmount*3).toFixed(2))
					}
					if($(this).val() == 2){
						$("#payPz").val((pzAmount*2).toFixed(2))
					}					
					if($(this).val() == 1){
						$("#payPz").val(0)
					}
			   })
				
				
					//				if(payRj == "") {
					//					$("#payRj").val();
					//					$("#payPz").val();
					//				} 
					if(maxPz > 5000000) {
						maxPz = 5000000;
					}
					$('#payPz').attr('max', maxPz);
					$('#payPz').val(maxPz);
					$('#Pz').html('(可借贷最大金额' + maxPz + ')');
					//				if(payRj <= nowYE) {
					//					$("#payPz").val(maxPz);
					//				} else {
					//					alert("输入金额大");
					//					$("#payRj").val(nowYE);
					//				}

				});
				$('#payRj').change();

				$("#payPz").change(function() {
					//alert(1);
					//				nowLH	当前劣后
					//				nowYX	当前优先
					//				nowYE	余额
					var nowLH = $(".nowLH").html();
					var nowYX = $(".nowYX").html();
					var nowYE = $(".nowYE").html();
					var payRj = $("#payRj").val();
					var payPz = $("#payPz").val();
					var maxPz = (parseFloat(payRj) + parseFloat(nowLH)) * 10;

					if(payPz > maxPz) {
						alert("可借贷最大金额" + maxPz);
						$("#payPz").val(maxPz);
					}

				});

				//6、判断checkbox是否选中（jquery 1.6以前版本 用  $(this).attr("checked")）
				$("#noFundAllocation").click(function() {
					if($(this).prop("checked")) {
						$("#payPz").attr("readonly", true);
					} else {
						$("#payPz").attr("readonly", false);
					}
				});
			</script>
	</body>

</html>